package com.wyclabs.mq.eventbus;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.Data;
import org.springframework.amqp.rabbit.connection.CorrelationData;

import java.io.Serializable;

/**
 * 一致性事件
 * @author TylerW
 * @date 2020/4/7 13:49
 */
@Data
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
public abstract class ConsistenceEvent implements DirectionalEvent, Serializable {

    /**
     * 消息确认唯一ID
     */
    private CorrelationData correlationData;

    /**
     * 下游服务名称
     */
    private String[] servers;

    public ConsistenceEvent() {
        servers = servers();
    }

    public CorrelationData getCorrelationData() {
        return correlationData;
    }

    public void setCorrelationData(CorrelationData correlationData) {
        this.correlationData = correlationData;
    }
}
